home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Gold Collection / Software Vault - The Gold Collection (American Databankers) (1993).ISO / cdr47 / wasm223.zip / SERIAL6.ASM < prev    next >
Assembly Source File  |  1993-05-04  |  2KB  |  87 lines

  1. ;**********************************;
  2. ; WASM Serial I/O, Empty Pipe      ;
  3. ; By Eric Tauck                    ;
  4. ;                                  ;
  5. ; Defines:                         ;
  6. ;                                  ;
  7. ;   ComEmp  wait for pause in flow ;
  8. ;                                  ;
  9. ; Requires:                        ;
  10. ;                                  ;
  11. ;   SERIAL1.ASM                    ;
  12. ;   TICKS.ASM                      ;
  13. ;**********************************;
  14.  
  15.         jmps    _serial6_end
  16.  
  17. ;========================================
  18. ; Empty the pipe (wait for a pause in the
  19. ; data flow).
  20. ;
  21. ; In: BX= record address; AX= pause
  22. ;     duration ticks; DX= timeout ticks.
  23. ;
  24. ; Out: CY= set if timeout (i.e. no
  25. ;      pause).
  26.  
  27. ComEmp  PROC    NEAR
  28.         push    di
  29.         push    si
  30.         push    bp
  31.  
  32.         mov     di, ax
  33.         mov     si, dx
  34.         mov     bp, bx
  35.  
  36. ;--- start outer timer
  37.  
  38.         sub     al, al          ;timer zero
  39.         call    TicRes          ;reset timer
  40.  
  41. ;--- start/restart inner timer
  42.  
  43. _cmemp1 mov     al, 1           ;timer 1
  44.         call    TicRes          ;reset timer
  45.         mov     bx, bp
  46.         call    ComClr          ;clear any input
  47.  
  48. ;--- check if timeout
  49.  
  50. _cmemp2 sub     al, al          ;timer zero
  51.         call    TicPas          ;get ticks
  52.         cmp     ax, si          ;check if timeout
  53.         jae     _cmemp3         ;exit if so
  54.  
  55. ;--- check if any bytes received
  56.  
  57.         mov     bx, bp
  58.         call    ComByt          ;get bytes in buffer
  59.         or      ax, ax          ;check if any
  60.         jnz     _cmemp1         ;restart timer if so
  61.  
  62. ;--- check if inner timeout
  63.  
  64.         mov     al, 1           ;timer 1
  65.         call    TicPas          ;get ticks passed
  66.         cmp     ax, di          ;check if timeout
  67.         jb      _cmemp2         ;loop back if
  68.  
  69. ;--- finished with pause
  70.  
  71.         pop     bp
  72.         pop     si
  73.         pop     di
  74.         clc
  75.         ret
  76.  
  77. ;--- finished by timeout (no pause in flow)
  78.  
  79. _cmemp3 pop     bp
  80.         pop     si
  81.         pop     di
  82.         stc
  83.         ret
  84.         ENDP
  85.  
  86. _serial6_end
  87.